package com.puhui.chome.util;

public class StringUtil {

    private StringUtil() {
        super();
    }

    /**
     * 是否为空
     * 
     * @param str
     * @return
     */
    public static boolean isEmpty(Object str) {
        return str == null || "".equals(str);
    }

    /**
     * 获取数据库表字段名称
     * 
     * @author dingxingang
     * @param fName
     * @return
     */
    public static String getFieldName(String fName) {
        String fieldName = "";
        char[] ns = fName.toCharArray();
        for (char n : ns) {
            if (Character.isLowerCase(n)) {
                fieldName += Character.toString(n);
            } else {
                String s = Character.toString(n);
                fieldName += "_" + s.toLowerCase();
            }
        }
        return fieldName;
    }

}
